<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test {
            border: 1px solid red;
        }

        h1 {
            /* width: 25.5px; */
            color: rgb(84, 84, 119);
        }

        canvas {
            margin-top: 40px;
            /* border: 4px solid rebeccapurple; */
        }

        .icon {
            width: 60px;
            height: 50px;
            background: url('./imgs/cat.jpg') no-repeat;
            background-size: 100% 100%;
        }

        .icon2 {
            width: 60px;
            height: 50px;
            background: url('./imgs/BBGS.jpg') no-repeat;
            background-size: 100% 100%;
        }

        .list {
            padding: 10px 20px;
        }

        .item {
            display: flex;
            margin-bottom: 10px;
            box-shadow: 0px 2px 20px #999;
            border-radius: 10px;
        }

        .icon {
            border-radius: 10px;
        }

        .rt {
            padding-left: 10px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        .test{
            height: 800px;
        }
        .item1{
            border: 1px solid rebeccapurple;
        }
    </style>
</head>

<body>
    <h1>canvas绘制测试1 图片合成测试 ，渐变测试 ，按钮测试</h1>
    <div class="test">
        <div class="list">
            <div class="item item1">
                <img src="../imgs/cat.jpg" class="icon" alt="" srcset="">
                <div class="rt">
                    <div class="title">我是title1</div>
                    <div class="title">我得第一名</div>
                </div>
            </div>
            <div class="item">
                <img src="../imgs/cat.jpg" class="icon" alt="" srcset="">
                <div class="rt">
                    <div class="title">我是title2</div>
                    <div class="title">我得第一名</div>
                </div>
            </div>
        </div>
    </div>
  
    <!-- <div class="item">
                <img src="./imgs/cat.jpg" class="icon" alt="" srcset="">
                <div class="rt">
                    <div class="title">我是title1</div>
                    <div class="title">我得第一名</div>
                </div>
            </div> -->
    <h1>canvas绘制</h1>
    <canvas id="canvas"></canvas>
</body>
<script src="../dist/main.js"></script>

<script>
    const root = document.querySelector(".test")
    layout(root, 'canvas')
    let timer;
    window.addEventListener('resize', () => {
        if (timer) { clearTimeout(timer) }
        timer = setTimeout(function () {
            layout(root, 'canvas')

        }, 100);
    })
</script>

</html>